# coding: utf-8

from sqlalchemy import text


class Statement(object):

    insert_im_msg_sql = """
        insert into im_messages
            (
                im_from, 
                im_to, 
                message_type, 
                message,
                group_id, 
                read_status,  
                created_at, 
                updated_at
            )
        values {insert_values};
    """

    five_min_winner_sql = text("""
        select 
            supplier_id, 
            partic.id, 
            demand_status, 
            partic.status, 
            offer
        from partic
        where 
            demand_id=:demand_id
            and partic.deleted_at=0
            and demand_status=10
            and partic.status=10
            and partic.published_count=:published_count
        order by 
            offer desc, 
            partic.credit desc, 
            partic.id asc
    """)

    find_follow_relation_sql = text("""
        select
            follower_id, followed_id
        from
            follows
        where
            follower_id=:follower_id
            and followed_id=:followed_id;
    """)
